﻿using System.Linq;
using Wayloop.Blog.Core.Data;
using Wayloop.Blog.Core.Data.Entities;


namespace Wayloop.Blog.DataAccess.Repositories
{
    public class CommentRepository : AbstractRepository<Comment>, ICommentRepository
    {
        public override IQueryable<Comment> FindAll()
        {
            return base.FindAll().OrderBy(x => x.CreatedOn);
        }


        public IQueryable<Comment> FindAllByStatus(CommentStatus status)
        {
            return FindAll().Where(x => x.Status == status);
        }


        public IQueryable<Comment> FindAllByStatus(CommentStatus status, int pageIndex, int pageSize)
        {
            return FindAll(pageIndex, pageSize).Where(x => x.Status == status);
        }
    }
}